<?php
namespace Amis\form;
class Color extends FormItem
{
    public string $type = 'input-color';

    public function format(string $format = 'hex')
    {
        if (in_array($format, ['hex', 'hls', 'rgb', 'rgba'])) {
            $this->format = $format;
        }
        return $this;
    }

    public function presetColors(array $presetColors)
    {
        $this->presetColors = $presetColors;
        return $this;
    }

    public function allowCustomColor(bool $allowCustomColor = false)
    {
        $this->allowCustomColor = $allowCustomColor;
        return $this;
    }

    public function clearable(string $clearable = 'label')
    {
        $this->clearable = $clearable;
        return $this;
    }

    public function resetValue(string $resetValue = '')
    {
        $this->resetValue = $resetValue;
        return $this;
    }
}